<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:sistema="http://sistema.com.br/jsf">

	<rich:modalPanel id="modalPanel" width="430" height="250" onshow="#{usuarioModalMB.campoNome.elementById}.focus();" showWhenRendered="#{usuarioModalMB.modalPanelShow}">
        <f:facet name="header">
            <h:panelGroup>
                <h:outputText value="#{usuarioModalMB.titulo}" />
            </h:panelGroup>
        </f:facet>

        <f:facet name="controls">
            <h:panelGroup>
            	<a4j:form id="formMenuPanel">
	                <h:commandLink action="#" immediate="true" id="linkCloseMenu">
	                	<a4j:support event="onclick" reRender="modalPanel" action="#{usuarioModalMB.cancelar}" immediate="true" ajaxSingle="true" disableDefault="true" />
	                	<h:graphicImage value="../../../static/img/close.png" styleClass="hidelink" />
	                </h:commandLink>
				</a4j:form>
            </h:panelGroup>
        </f:facet>

		<a4j:outputPanel ajaxRendered="true" id="painelMensagemModal" layout="block" style="height: 38px;"> 
				<sistema:mensagem />
 		</a4j:outputPanel>

		<h:form id="#{usuarioModalMB.campoNome.nameForm}" prependId="#{usuarioModalMB.campoNome.prependId}">

			<a4j:keepAlive beanName="usuarioMB"/>
			<a4j:keepAlive beanName="usuarioModalMB"/>
	
			<fieldset class="lm">

				<br />

				<h:panelGrid columns="2">
		        	<h:outputText value="#{usuarioModalMB.campoNome.nameDisplay}" />
		        	<h:inputText 	required= "true"
			        	value=      "#{usuarioModalMB.registro.nome}" 
			        	id=         "#{usuarioModalMB.campoNome.id}"
			        	size=       "#{usuarioModalMB.campoNome.sizeMax}" 
			        	maxlength=  "#{usuarioModalMB.campoNome.maxlength}" 
			        	onkeypress= "#{usuarioModalMB.campoNome.onkeypress}" >
			        		<f:validateLength minimum="#{usuarioModalMB.campoNome.sizeMin}"  maximum="#{usuarioModalMB.campoNome.sizeMax}" /> 
			        </h:inputText>

					<h:outputText value="#{usuarioModalMB.campoLogin.nameDisplay}" />
		        	<h:inputText 	required= "true" 
			        	value=      "#{usuarioModalMB.registro.login}" 
			        	id=         "#{usuarioModalMB.campoLogin.id}"
			        	size=       "#{usuarioModalMB.campoLogin.sizeMax}" 
			        	maxlength=  "#{usuarioModalMB.campoLogin.maxlength}" 
			        	onkeypress= "#{usuarioModalMB.campoLogin.onkeypress}">
		        			<f:validateLength minimum="#{usuarioModalMB.campoLogin.sizeMin}"  maximum="#{usuarioModalMB.campoLogin.sizeMax}" /> 
				    </h:inputText>
				    <h:outputText value="#{usuarioModalMB.campoSenha.nameDisplay}" />
		        	<h:inputSecret 	required= "true" disabled="${usuarioModalMB.edicao}"
			        	value=      "#{usuarioModalMB.registro.senha}"
			        	id=         "#{usuarioModalMB.campoSenha.id}"
			        	size=       "#{usuarioModalMB.campoSenha.sizeMax}"
			        	maxlength=  "#{usuarioModalMB.campoSenha.maxlength}"
			        	onkeypress= "#{usuarioModalMB.campoSenha.onkeypress}">
		        			<f:validateLength minimum="#{usuarioModalMB.campoSenha.sizeMin}"  maximum="#{usuarioModalMB.campoSenha.sizeMax}" /> 
				    </h:inputSecret>

				    <h:outputText value="#{usuarioModalMB.campoGrupo.nameDisplay}" />
					<rich:comboBox  required= "true"
						value=      "#{usuarioModalMB.registro.grupo}"
						id=         "grupo"
						width=		"#{usuarioModalMB.campoGrupo.sizeMax}"
        				directInputSuggestions="true" 
        				defaultLabel="#{usuarioModalMB.defaultLabelGrupo}" >
        				<f:converter converterId="grupoConverter" />
        				<f:selectItems value="#{usuarioModalMB.listaGruposItens}"/>

        			</rich:comboBox>
				
				
				</h:panelGrid>
				
			</fieldset>

				<br />
	
				<a4j:commandButton id="#{usuarioModalMB.submit}"   value="#{usuarioModalMB.submit}"   action="#{usuarioModalMB.salvar}"   styleClass="w90 pointer" reRender="modalPanel, panelPaginacao, tabelaDados" limitToList="#{usuarioModalMB.modalPanelShow}" />
				<rich:spacer width="10"/>
				<a4j:commandButton immediate="true" id="#{usuarioModalMB.cancelar}" value="#{usuarioModalMB.cancelar}" action="#{usuarioModalMB.cancelar}" styleClass="w90 pointer" reRender="modalPanel, panelPaginacao, tabelaDados" />

		</h:form>

    </rich:modalPanel>

</html>